package cn.hn.tx.rebot.task.job;

import cn.hn.tx.rebot.task.service.ITaskService;
import cn.hn.comm.exception.IExceptionService;;

public abstract class ITaskJob implements Runnable {

	final public static int TASK_ENABLE=0;
	final public static int TASK_DISABLE=1;
	
	private Thread thread;
	
	
	//任务执行日志
	private ITaskService taskService;
	
	//异常记录
	private IExceptionService exceptionService;

	abstract void executeJob();
	
	public abstract TaskType type();
	

	public String getTaskName() {
		return type().getTypeName();
	}

	public void startJob() {
		thread = new Thread(this);
		thread.start();
	}

	public void run() {
		executeJob();
	}


	public ITaskService getTaskService() {
		return taskService;
	}

	public void setTaskService(ITaskService taskService) {
		this.taskService = taskService;
	}

	public IExceptionService getExceptionService() {
		return exceptionService;
	}

	public void setExceptionService(IExceptionService exceptionService) {
		this.exceptionService = exceptionService;
	}
	
	
}
